package com.example.service;

import com.example.entity.ReimbursementRecord;
import com.example.mapper.ReimbursementRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReimbursementRecordService {

    @Autowired
    private ReimbursementRecordMapper reimbursementRecordMapper;

    public void addReimbursementRecord(ReimbursementRecord record) {
        reimbursementRecordMapper.insert(record);  // 记录报销信息
    }

    public ReimbursementRecord getReimbursementRecordById(int id) {
        return reimbursementRecordMapper.selectById(id);  // 查询报销记录
    }

    public List<ReimbursementRecord> getAllReimbursementRecords() {
        return reimbursementRecordMapper.selectList(null);  // 查询所有报销记录
    }

    public void updateReimbursementRecord(ReimbursementRecord record) {
        reimbursementRecordMapper.updateById(record);  // 更新报销记录
    }


    public List<ReimbursementRecord> getReimbursementRecordsByInsuredPersonId(int insuredPersonId) {
        return reimbursementRecordMapper.getReimbursementRecordsByInsuredPersonId(insuredPersonId);
    }

    public void deleteReimbursementRecord(int id) {
        reimbursementRecordMapper.deleteById(id);  // 删除报销记录
    }
}
